import javax.imageio.*;
import java.io.File;
import java.awt.image.BufferedImage;
import java.io.IOException;

public class ImageCutting {
	public static void main(String[] args) {
		try{
			BufferedImage image = ImageIO.read(new File("src/dengjie.png"));
			int width = image.getWidth();
			int height = image.getHeight();
			int[] imageArray = new int[width*height];
			image.getRGB(0,0,width,height,imageArray,0,width);
			BufferedImage imageNew = new BufferedImage(width/2,height/2,BufferedImage.TYPE_INT_RGB);
			imageNew.setRGB(0,0,width/2,height/2,imageArray,0,width);
			File outFile = new File("src/newdengjie.png");
			ImageIO.write(imageNew, "png",  outFile);
			
		} catch (IOException e){
			e.printStackTrace();
		}
	}
}
		
		
			
		
		
	


